package com.hydra.auth.config.exception;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

@JsonSerialize(using = BootOAuthExceptionJacksonSerializer.class)
public class BootOAuth2Exception extends OAuth2Exception {

    @Getter @Setter
    int code;

    public BootOAuth2Exception(int code, String msg, Throwable t) {
        super(msg, t);
        this.code = code;
    }

    public BootOAuth2Exception(String msg) {
        super(msg);
    }

    @Override
    public int getHttpErrorCode() {
        return code;
    }
}
